class Registry:
    def __init__(self):
        self._registry = {}

    def register(self, name):
        def decorator(cls):
            self._registry[name] = cls
            return cls

        return decorator

    def get(self, name):
        if name not in self._registry:
            raise ValueError(f"Model {name} not found in registry.")
        return self._registry[name]

    def list_models(self):
        return list(self._registry.keys())


# 创建全局注册器实例
MODEL_REGISTRY = Registry()
